<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:local="clr-namespace:WbfsSync.Controls">

    <!-- Image button -->

    <Style TargetType="{x:Type local:ImageButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ImageButton}">
                    
                    <Border Name="MainBorder" BorderBrush="{x:Null}">
                        <Border.Background>
                            <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ImageSource}" 
                                        Viewbox="0.25,0,0.25,1"/>
                        </Border.Background>
                        <ContentPresenter />
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ImageSource}" 
                                        Viewbox="0,0,0.25,1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ImageSource}" 
                                        Viewbox="0.5,0,0.25,1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ImageSource}" 
                                        Viewbox="0.75,0,0.25,1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                    
                </ControlTemplate> 
            </Setter.Value>
        </Setter>
    </Style>

    <!-- PlainView Default Style for ListView -->
    
    <Style x:Key="{ComponentResourceKey 
           TypeInTargetAssembly={x:Type local:PlainView},
           ResourceId=myPlainViewDSK}" 
           TargetType="{x:Type ListView}" 
           BasedOn="{StaticResource {x:Type ListBox}}">
        
        <Setter Property="HorizontalContentAlignment" 
                Value="Center"/>

        <Setter Property="ItemContainerStyle" 
                Value="{Binding (ListView.View).ItemContainerStyle,
                RelativeSource={RelativeSource Self}}"/>
        
        <Setter Property="ItemTemplate" 
                Value="{Binding (ListView.View).ItemTemplate,
                RelativeSource={RelativeSource Self}}"/>
        
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Width="{Binding (FrameworkElement.ActualWidth),
                     RelativeSource={RelativeSource 
                                     AncestorType=ScrollContentPresenter}}"
                     ItemWidth="{Binding (ListView.View).ItemWidth,
                     RelativeSource={RelativeSource AncestorType=ListView}}"
                     MinWidth="{Binding (ListView.View).ItemWidth,
                     RelativeSource={RelativeSource AncestorType=ListView}}"
                     ItemHeight="{Binding (ListView.View).ItemHeight,
                     RelativeSource={RelativeSource AncestorType=ListView}}"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- File operation button -->

    <Style TargetType="{x:Type local:FileOpButton}">
        <Style.Resources>
            <ResourceDictionary />
        </Style.Resources>
        <Setter Property="UIElement.Focusable">
            <Setter.Value>
                <s:Boolean>True</s:Boolean>
            </Setter.Value>
        </Setter>
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:FileOpButton}">
                    <Grid>
                        <Rectangle Margin="0" RadiusX="2" RadiusY="2" StrokeThickness="1" Name="OuterRectangle" Grid.Column="0" />
                        <Rectangle Margin="1" RadiusX="2" RadiusY="2" StrokeThickness="1" Name="InnerRectangle" Grid.Column="0" Fill="Transparent" Stroke="Transparent" />
                        <Image Name="ArrowIcon" Margin="5,16,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Height="16" Width="16" Source="C:\Users\Caian\Documents\Visual Studio 2008\Projects\WBFSSync\SkinSeven\Icons\arrow_16px.png" />
                        <TextBlock Name="Message0" FontSize="15.7" Foreground="#003399" Margin="24,8,0,0" Height="26" HorizontalAlignment="Left" VerticalAlignment="Top">Copy and Replace</TextBlock>
                        <TextBlock Name="Message1" FontSize="11.9" Foreground="#003399" Margin="24,28,0,0" Height="26" HorizontalAlignment="Left" VerticalAlignment="Top">Replace the file in the destination...</TextBlock>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="UIElement.IsEnabled">
                            <Setter Property="Shape.Fill" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <SolidColorBrush Color="White" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <SolidColorBrush Color="White" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="OuterRectangle">
                                <Setter.Value>
                                    <SolidColorBrush Color="White" />
                                </Setter.Value>
                            </Setter>
                            <Trigger.Value>
                                <s:Boolean>False</s:Boolean>
                            </Trigger.Value>
                        </Trigger>
                        <Trigger Property="UIElement.IsMouseOver">
                            <Setter Property="Shape.Fill" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFCFDFF" Offset="0" />
                                            <GradientStop Color="#FFEDF5FF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFDFEFF" Offset="0" />
                                            <GradientStop Color="#FFF3F8FF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="OuterRectangle">
                                <Setter.Value>
                                    <SolidColorBrush Color="#FFB9D7FC" />
                                </Setter.Value>
                            </Setter>
                            <Trigger.Value>
                                <s:Boolean>True</s:Boolean>
                            </Trigger.Value>
                        </Trigger>
                        <Trigger Property="ButtonBase.IsPressed">
                            <Setter Property="Shape.Fill" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#ffddecfd" Offset="0" />
                                            <GradientStop Color="#ffc2dcfd" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="InnerRectangle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#ffebf4fd" Offset="0" />
                                            <GradientStop Color="#ffdbeafd" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="OuterRectangle">
                                <Setter.Value>
                                    <SolidColorBrush Color="#ff7ea2ce" />
                                </Setter.Value>
                            </Setter>
                            <Trigger.Value>
                                <s:Boolean>True</s:Boolean>
                            </Trigger.Value>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- Borderless TextBox -->

    <Style TargetType="{x:Type local:BorderlessTextBox}">
        <Style.BasedOn>
            <Style TargetType="{x:Type local:BorderlessTextBox}">
                <Style.Resources>
                    <ResourceDictionary />
                </Style.Resources>
                <Setter Property="TextElement.Foreground">
                    <Setter.Value>
                        <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
                    </Setter.Value>
                </Setter>

                <Setter Property="Panel.Background">
                    <Setter.Value>
                        <SolidColorBrush Color="Transparent" />
                    </Setter.Value>
                </Setter>

                <Setter Property="Border.BorderBrush">
                    <Setter.Value>
                        <SolidColorBrush Color="Black" />
                    </Setter.Value>
                </Setter>

                <Setter Property="Border.BorderThickness">
                    <Setter.Value>
                        <Thickness>0,0,0,0</Thickness>
                    </Setter.Value>
                </Setter>

                <Setter Property="Control.Padding">
                    <Setter.Value>
                        <Thickness>1,1,1,1</Thickness>
                    </Setter.Value>
                </Setter>
                <Setter Property="UIElement.AllowDrop">
                    <Setter.Value>
                        <s:Boolean>True</s:Boolean>
                    </Setter.Value>
                </Setter>
                <Setter Property="FrameworkElement.FocusVisualStyle">
                    <Setter.Value>
                        <x:Null />
                    </Setter.Value>
                </Setter>
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TextBox">

                            <mwt:ListBoxChrome Background="{TemplateBinding Panel.Background}" BorderBrush="{TemplateBinding Border.BorderBrush}" BorderThickness="{TemplateBinding Border.BorderThickness}" RenderMouseOver="{TemplateBinding UIElement.IsMouseOver}" RenderFocused="{TemplateBinding UIElement.IsKeyboardFocusWithin}" Name="Bd" SnapsToDevicePixels="True">
                                <ScrollViewer Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                            </mwt:ListBoxChrome>

                            <ControlTemplate.Triggers>

                                <Trigger Property="UIElement.IsEnabled">

                                    <Setter Property="TextElement.Foreground">
                                        <Setter.Value>
                                            <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                                        </Setter.Value>
                                    </Setter>
                                    <Trigger.Value>
                                        <s:Boolean>False</s:Boolean>
                                    </Trigger.Value>
                                </Trigger>

                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.BasedOn>
        <Style.Resources>
            <ResourceDictionary />
        </Style.Resources>
    </Style>

    <!-- PathButton -->

    <Style TargetType="{x:Type local:PathButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:PathButton}">

                    <Border Name="MainBorder" BorderThickness="1,0,1,0">
                        <Grid>
                            <Rectangle Name="InnerRect" Margin="0" StrokeThickness="1"/>
                            <Rectangle Name="LeftShadow" Margin="0" HorizontalAlignment="Left" Width="2"/>
                            <Rectangle Name="TopShadow" Margin="0" VerticalAlignment="Top" Height="2"/>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text}"
                                           Name="labelBlock"  VerticalAlignment="Center" Margin="4,-1,4,1"/>
                                <Image Source="../Icons/Navigation/navbar_arrowr.PNG" Stretch="Fill" Width="8px" Height="7px" 
                                       Name="arrowImage" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,-1"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Rectangle.Stroke" TargetName="InnerRect" Value="#AFFFFFFF"/>
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#3c7fb1"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#eaf6fd"/>
                                        <GradientStop Offset="0.5" Color="#d7effc"/>
                                        <GradientStop Offset="0.5" Color="#bde6fd"/>
                                        <GradientStop Offset="1" Color="#a6d9f4"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Image.Source" TargetName="arrowImage" 
                                    Value="../Icons/Navigation/navbar_arrowd.PNG"/>
                            <Setter Property="TextBlock.Margin" TargetName="labelBlock" Value="5,0,3,0"/>
                            <Setter Property="Rectangle.Stroke" TargetName="InnerRect" Value="Transparent"/>
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#2c628b"/>
                            <Setter Property="Rectangle.Fill" TargetName="LeftShadow">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <GradientStop Offset="0" Color="#80000000"/>
                                        <GradientStop Offset="1" Color="#10000000"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Rectangle.Fill" TargetName="TopShadow">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#80000000"/>
                                        <GradientStop Offset="1" Color="#10000000"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#c2e4f6"/>
                                        <GradientStop Offset="0.5" Color="#c2e4f6"/>
                                        <GradientStop Offset="0.5" Color="#a9d9f2"/>
                                        <GradientStop Offset="1" Color="#90cbeb"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- QuickLink Resources -->

    <Style x:Key="TreeViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>

    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Width" Value="16"/>
        <Setter Property="Height" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
                        <Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="Transparent" Stroke="#FF989898">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135" CenterY="3" CenterX="3"/>
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
                            <Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="RenderTransform" TargetName="ExpandPath">
                                <Setter.Value>
                                    <RotateTransform Angle="180" CenterY="3" CenterX="3"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
                            <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <LinearGradientBrush x:Key="TreeViewItemHoverFill" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#fffafbfd" Offset="0"/>
        <GradientStop Color="#ffebf3fd" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="TreeViewItemSelectedFill" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#ffebf4fe" Offset="0"/>
        <GradientStop Color="#ffcfe4fe" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="TreeViewItemSelectedInactiveFill" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#fff8f8f8" Offset="0"/>
        <GradientStop Color="#ffe5e5e5" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="TreeViewItemSelectedHoverFill" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#ffdcebfc" Offset="0"/>
        <GradientStop Color="#ffc1dbfc" Offset="1"/>
    </LinearGradientBrush>

    <!-- QuickLink Style -->

    <Style TargetType="{x:Type local:QuickLink}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Padding" Value="1,0,0,0"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:QuickLink}">

                    <!-- Uggly layout, fix me -->

                    <Grid>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" MinHeight="21"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <Border x:Name="Bd" BorderThickness="1" 
                                    Grid.Row="0" Grid.RowSpan="1"
                                    BorderBrush="{TemplateBinding BorderBrush}" 
                                    Background="{TemplateBinding Background}" 
                                    Padding="{TemplateBinding Padding}" 
                                    SnapsToDevicePixels="true" CornerRadius="2">

                            <Border x:Name="InnerBorder" BorderThickness="1"
                                        CornerRadius="1" SnapsToDevicePixels="True"/>
                        </Border>

                        <Grid x:Name="HitTester" Background="Transparent"
                              Grid.Row="0" Grid.RowSpan="1">
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="{Binding Level, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <ColumnDefinition MinWidth="19" Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            
                            <ToggleButton x:Name="Expander" ClickMode="Press" Grid.Column="1"
                                              IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                                              Style="{StaticResource ExpandCollapseToggleStyle}"/>

                            <StackPanel Grid.Column="2" Orientation="Horizontal">
                                <Image Source="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}"
                                       VerticalAlignment="Center" Stretch="None" SnapsToDevicePixels="True" Margin="0,2,5,3"/>
                                
                                <TextBlock Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
                                           FontFamily="{Binding FontFamily, RelativeSource={RelativeSource TemplatedParent}}"
                                           FontSize="{Binding FontSize, RelativeSource={RelativeSource TemplatedParent}}"
                                           FontStretch="{Binding FontStretch, RelativeSource={RelativeSource TemplatedParent}}"
                                           FontStyle="{Binding FontStyle, RelativeSource={RelativeSource TemplatedParent}}"
                                           FontWeight="{Binding FontWeight, RelativeSource={RelativeSource TemplatedParent}}"
                                           Foreground="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
                                           SnapsToDevicePixels="True" VerticalAlignment="Center" Margin="0"/>
                            </StackPanel>
                        </Grid>

                        <Grid Grid.Row="1" Grid.RowSpan="1">
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="{Binding Level, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            
                            <ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="1"/>
                        </Grid>

                    </Grid>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsExpanded" Value="false">
                            <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
                        </Trigger>

                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Background" Value="{StaticResource TreeViewItemSelectedFill}"/>
                            <Setter Property="BorderBrush" Value="#ff84acdd"/>
                            <Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
                        </Trigger>

                        <Trigger Property="IsMouseOver" SourceName="HitTester" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource TreeViewItemHoverFill}"/>
                            <Setter Property="BorderBrush" Value="#ffb8d6fb"/>
                            <Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true"/>
                                <Condition Property="IsMouseOver" SourceName="HitTester" Value="true"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource TreeViewItemSelectedHoverFill}"/>
                            <Setter Property="BorderBrush" Value="#ff7da2ce"/>
                            <Setter Property="BorderBrush" TargetName="InnerBorder" Value="#80FFFFFF"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true"/>
                                <Condition Property="IsSelectionActive" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource TreeViewItemSelectedInactiveFill}"/>
                            <Setter Property="BorderBrush" Value="#ffd9d9d9"/>
                        </MultiTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!-- MenuButton Style -->

    <Style TargetType="{x:Type local:MenuButton}">
        <Setter Property="Foreground" Value="#ff1e395b"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MenuButton}">

                    <Border Name="MainBorder" Background="Transparent" 
                            BorderThickness="1" CornerRadius="2"
                            SnapsToDevicePixels="True">
                        
                        <Border Name="InnerBorder" BorderThickness="1" 
                                CornerRadius="1" SnapsToDevicePixels="True">
                            <ContentPresenter x:Name="content" Margin="4,0,4,0" 
                                              VerticalAlignment="Center"
                                              HorizontalAlignment="Center"/>
                        </Border>
                    </Border>

                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Border.BorderBrush" TargetName="InnerBorder" Value="#ccffffff"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0.5" Color="#30ffffff"/>
                                        <GradientStop Offset="0.5" Color="#30aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Border.BorderBrush" TargetName="InnerBorder" Value="{x:Null}"/>
                            <Setter Property="Margin" TargetName="content" Value="5,1,3,-1"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#ffaabcd5"/>
                                        <GradientStop Offset="0.15" Color="#55aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- MenuToggleButton Style -->

    <Style TargetType="{x:Type local:MenuToggleButton}">
        <Setter Property="Foreground" Value="#ff1e395b"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MenuToggleButton}">

                    <Border Name="MainBorder" Background="Transparent" 
                            BorderThickness="1" CornerRadius="2"
                            SnapsToDevicePixels="True">

                        <Border Name="InnerBorder" BorderThickness="1" 
                                CornerRadius="1" SnapsToDevicePixels="True">
                            <ContentPresenter x:Name="content" Margin="4,0,4,0" 
                                              VerticalAlignment="Center"
                                              HorizontalAlignment="Center"/>
                        </Border>
                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Border.BorderBrush" TargetName="InnerBorder" Value="#ccffffff"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0.5" Color="#30ffffff"/>
                                        <GradientStop Offset="0.5" Color="#30aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Border.BorderBrush" TargetName="InnerBorder" Value="{x:Null}"/>
                            <Setter Property="Margin" TargetName="content" Value="5,1,3,-1"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#ffaabcd5"/>
                                        <GradientStop Offset="0.15" Color="#55aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        
                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Border.BorderBrush" TargetName="InnerBorder" Value="{x:Null}"/>
                            <Setter Property="Margin" TargetName="content" Value="5,1,3,-1"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#ffaabcd5"/>
                                        <GradientStop Offset="0.15" Color="#55aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ViewSelectorButton Style -->

    <Style TargetType="{x:Type local:ViewSelectorButton}">
        <Setter Property="Foreground" Value="#ff1e395b"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ViewSelectorButton}">

                    <Border Name="MainBorder" Background="Transparent" 
                            BorderThickness="1" CornerRadius="2"
                            SnapsToDevicePixels="True">

                        <Grid>
                            <Rectangle Name="InnerRect" Margin="0" StrokeThickness="1" RadiusX="1" RadiusY="1" SnapsToDevicePixels="True"/>
                            <Rectangle Name="LeftShadow" Margin="0" HorizontalAlignment="Left" Width="3"/>
                            <Rectangle Name="TopShadow" Margin="0" VerticalAlignment="Top" Height="8"/>
                            <Border>
                                <ContentPresenter x:Name="content"
                                                  SnapsToDevicePixels="True"
                                                  VerticalAlignment="Center" 
                                                  HorizontalAlignment="Left"
                                                  Margin="2,0,0,0" />
                            </Border>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffa8a8a8"/>
                            <Setter Property="Rectangle.Stroke" TargetName="InnerRect" Value="#ccffffff"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#ccffffff"/>
                                        <GradientStop Offset="0.5" Color="#00ffffff"/>
                                        <GradientStop Offset="0.5" Color="#20000000"/>
                                        <GradientStop Offset="1" Color="#00000000"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ff545454"/>
                            <Setter Property="Rectangle.Stroke" TargetName="InnerRect" Value="{x:Null}"/>
                            <Setter Property="Margin" TargetName="content" Value="3,1,-1,-1"/>
                            <Setter Property="Border.Background" TargetName="MainBorder" Value="#e4e4e4"/>
                            <Setter Property="Rectangle.Fill" TargetName="LeftShadow">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <GradientStop Offset="0" Color="#30000000"/>
                                        <GradientStop Offset="1" Color="#10000000"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Rectangle.Fill" TargetName="TopShadow">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#30000000"/>
                                        <GradientStop Offset="1" Color="#00000000"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- MenuDropButton Style -->

    <Style TargetType="{x:Type local:MenuDropButton}">
        <Setter Property="Foreground" Value="#ff1e395b"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MenuDropButton}">

                    <Border Name="MainBorder" Background="Transparent" 
                            BorderThickness="1" CornerRadius="2"
                            SnapsToDevicePixels="True">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="19"/>
                            </Grid.ColumnDefinitions>

                            <Rectangle Name="InnerBorder" StrokeThickness="1" 
                                       RadiusX="1" RadiusY="1" SnapsToDevicePixels="True"
                                       Grid.Column="0" Grid.ColumnSpan="2"/>

                            <Border Grid.Column="0">
                                <ContentPresenter x:Name="content" Margin="4,0,0,0" 
                                                  VerticalAlignment="Center"
                                                  HorizontalAlignment="Left"
                                                  SnapsToDevicePixels="True"/>
                            </Border>

                            <Line x:Name="lLine" X1="0" X2="0" Y1="0" Y2="20" 
                                      Margin="0,1,18,1" StrokeThickness="1" 
                                      HorizontalAlignment="Right" 
                                      SnapsToDevicePixels="True"
                                      Grid.Column="1"/>

                            <Line x:Name="mLine" X1="0" X2="0" Y1="0" Y2="22" 
                                      Margin="0,0,17,0" StrokeThickness="1" 
                                      HorizontalAlignment="Right"
                                      SnapsToDevicePixels="True"
                                      Grid.Column="1"/>

                            <Line x:Name="rLine" X1="0" X2="0" Y1="0" Y2="20"
                                      Margin="0,1,16,1" StrokeThickness="1"
                                      HorizontalAlignment="Right"
                                      SnapsToDevicePixels="True"
                                      Grid.Column="1"/>

                            <Image x:Name="arrow" Source="../Icons/Navigation/arrow_down.png" Stretch="None"
                                       VerticalAlignment="Center" HorizontalAlignment="Right"
                                       Margin="0,1,4,-1" Grid.Column="1" SnapsToDevicePixels="True"/>

                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Rectangle.Stroke" TargetName="InnerBorder" Value="#ccffffff"/>
                            <Setter Property="Line.Stroke" TargetName="lLine" Value="#ffffffff"/>
                            <Setter Property="Line.Stroke" TargetName="rLine" Value="#ffffffff"/>
                            <Setter Property="Line.Stroke" TargetName="mLine" Value="#ffaabcd5"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0.5" Color="#30ffffff"/>
                                        <GradientStop Offset="0.5" Color="#30aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ButtonBase.IsPressed" Value="True">
                            <Setter Property="Border.BorderBrush" TargetName="MainBorder" Value="#ffaabcd5"/>
                            <Setter Property="Rectangle.Stroke" TargetName="InnerBorder" Value="{x:Null}"/>
                            <Setter Property="Margin" TargetName="content" Value="5,1,3,-1"/>
                            <Setter Property="Margin" TargetName="arrow" Value="1,2,3,-2"/>
                            <Setter Property="Line.Stroke" TargetName="lLine" Value="Transparent"/>
                            <Setter Property="Line.Stroke" TargetName="rLine" Value="Transparent"/>
                            <Setter Property="Line.Stroke" TargetName="mLine" Value="#ffaabcd5"/>
                            <Setter Property="Border.Background" TargetName="MainBorder">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#ffaabcd5"/>
                                        <GradientStop Offset="0.15" Color="#55aabcd5"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
